import request from '@/utils/axios';
const api_name = '/userList';


export default {

    // 获取用户列表
    getUserList() {
        return request({
            url: `${api_name}/getAllUserList`,
            method: 'get'
        });
    },

    // 根据用户名获取用户列表
    getUserListByUsername(username) {
        return request({
            url: `${api_name}/getUserListByUsername`,
            method: 'get',
            params: { username }
        });
    },

    addUserList(userInfo){
        return request({
            url: `${api_name}/addUserList`,
            method: 'post',
            data: userInfo
        });
    },

    updateUserList(userInfo){
        return request({
            url: `${api_name}/updateUserList`,
            method: 'put',
            data: userInfo
        });
    },

    deleteUserList(id){
        return request({
            url: `${api_name}/deleteUserList`,
            method: 'delete',
            params: { id }
        });
    }


}

